/*
 * 文件名：HelpManualService.java
 * 版权：Copyright by www.huawei.com
 * 描述：
 * 修改人：Administrator
 * 修改时间：2016年3月31日
 * 跟踪单号：
 * 修改单号：
 * 修改内容：
 */

package com.zcsy.manage.service.news.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zcsy.manage.model.news.HelpManual;
import com.zcsy.manage.persistence.news.HelpManualDao;
import com.zcsy.manage.service.news.IHelpManualService;

@Service
public class HelpManualService implements IHelpManualService {

	@Autowired
	private HelpManualDao helpManualDao;
	
	@Override
	public int insert(HelpManual helpManual) {
		return helpManualDao.insert(helpManual);
	}

	@Override
	public int update(HelpManual helpManual) {
		HelpManual oldManual = helpManualDao.selectByPrimaryKey(helpManual.getId());
		
		oldManual.setTitle(helpManual.getTitle());
		oldManual.setCellId(helpManual.getCellId());
		oldManual.setAnswer(helpManual.getAnswer());
		oldManual.setSort(helpManual.getSort());
		oldManual.setLogo(helpManual.getLogo());
		oldManual.setUserAccount(helpManual.getUserAccount());
		oldManual.setType(helpManual.getType());
		oldManual.setUpdateTime(helpManual.getUpdateTime());
		
		return helpManualDao.update(oldManual);
	}

	@Override
	public int deleteByPrimaryKey(String id) {
		return helpManualDao.deleteByPrimaryKey(id);
	}

	@Override
	public HelpManual selectByPrimaryKey(String id) {
		return helpManualDao.selectByPrimaryKey(id);
	}

	@Override
	public List<HelpManual> selectByKeyword(HelpManual helpManual) {
		return helpManualDao.selectByKeyword(helpManual);
	}

	@Override
	public int updateSort(HelpManual helpManual) {
		return helpManualDao.updateSort(helpManual);
	}

}
